package com.lee.taste.spider.sohu.db;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import org.apache.tomcat.jdbc.pool.DataSource;

import com.lee.taste.spider.SpringUtils;

public class DbUtils {
	
	private DataSource dataSource = (DataSource) SpringUtils.getBean("dataSource");
	
	public void update(String sql) throws SQLException{
		Connection connection = dataSource.getConnection();
		PreparedStatement ps = connection.prepareStatement(sql);
		ps.executeUpdate();
	}
	public void execute(String sql) throws SQLException{
		Connection connection = dataSource.getConnection();
		PreparedStatement ps = connection.prepareStatement(sql);
		ps.executeUpdate();
	}
}
